import { RouteRecordRaw } from 'vue-router';

declare module 'vue-router' {
	interface RouteMeta {
		title?: string;
		isLink?: string;
		isHide?: boolean;
		isKeepAlive?: boolean;
		isAffix?: boolean;
		isIframe?: boolean;
		roles?: string[];
		icon?: string;
	}
}

export const dynamicRoutes: Array<RouteRecordRaw> = [
      {
      path: '/',
      name: '/',
      component: () => import('@renderer/layout/index.vue'),
      redirect: '/home',
      meta: {
        isKeepAlive: true
      },
      children: [
        {
          path: '/home',
          name: 'home',
          redirect: '/home/home_panel',
          component: () => import('@renderer/layout/routerView/parent.vue'),
          meta: {
            title: 'message.router.home',
            isLink: '',
            isHide: false,
            isKeepAlive: false,
            isAffix: false,
            isIframe: false,
            roles: [],
            icon: 'fa fa-home'
          },
          children:[
            {
              path: '/home/home_panel',
              name: 'HomePanel',
              component: () => import('@renderer/views/home/index.vue'),
              meta: {
                title: 'message.router.HomePanel',
                isLink: '',
                isHide: false,
                isKeepAlive: true,
                isAffix: true,
                isIframe: false,
                roles: [],
                icon: 'fa fa-home'
              }
            }
          ]
        },
        {
            path: '/setting',
            name: 'setting',
            component: () => import('@renderer/layout/routerView/parent.vue'),
            redirect: '/setting/config',
            meta: {
              title: 'message.router.setting',
              isLink: '',
              isHide: false,
              isKeepAlive: true,
              isAffix: false,
              isIframe: false,
              roles: [],
              icon: 'fa fa-cog',
            },
            children:[
              {
                path: '/setting/config',
                name: 'config',
                component: () => import('@renderer/views/setting/config.vue'),
                meta: {
                  title: 'message.router.config',
                  isLink: '',
                  isHide: false,
                  isKeepAlive: true,
                  isAffix: true,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-cog',
                },
              }
            ]
        },
        {
          path: '/preview',
            name: 'Preview',
            component: () => import('@renderer/layout/routerView/parent.vue'),
            redirect: '/preview/preview_panel',
            meta: {
              title: 'message.router.Preview',
              isLink: '',
              isHide: false,
              isKeepAlive: true,
              isAffix: false,
              isIframe: false,
              roles: [],
              icon: 'fa fa-picture-o',
            },
            children:[
              {
                path: '/preview/preview_panel',
                name: 'PreviewPanel',
                component: () => import('@renderer/views/preview/PreviewPanel.vue'),
                meta: {
                  title: 'message.router.PreviewPanel',
                  isLink: '',
                  isHide: false,
                  isKeepAlive: true,
                  isAffix: false,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-picture-o',
                },
              },
              {
                path: '/preview/image_panel',
                name: 'ImagePanel',
                component: () => import('@renderer/views/images/ImagePanel.vue'),
                meta: {
                  title: 'message.router.ImagePanel',
                  isLink: '',
                  isHide: true,
                  isKeepAlive: true,
                  isAffix: false,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-picture-o',
                },
              },
            ]
        },
        {
          path: '/random',
            name: 'random',
            component: () => import('@renderer/layout/routerView/parent.vue'),
            redirect: '/random/random_panel',
            meta: {
              title: 'message.router.Random',
              isLink: '',
              isHide: false,
              isKeepAlive: true,
              isAffix: false,
              isIframe: false,
              roles: [],
              icon: 'fa fa-random',
            },
            children:[
              {
                path: '/random/random_panel',
                name: 'RandomPanel',
                component: () => import('@renderer/views/random/RandomPanel.vue'),
                meta: {
                  title: 'message.router.RandomPanel',
                  isLink: '',
                  isHide: false,
                  isKeepAlive: true,
                  isAffix: true,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-random',
                },
              },
              {
                path: '/random/prompt_panel',
                name: 'PromptPanel',
                component: () => import('@renderer/views/random/PromptPanel.vue'),
                meta: {
                  title: 'message.router.PromptPanel',
                  isLink: '',
                  isHide: false,
                  isKeepAlive: true,
                  isAffix: true,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-th',
                },
              },
              {
                path: '/random/add_prompt',
                name: 'AddPrompt',
                component: () => import('@renderer/views/random/AddPrompt.vue'),
                meta: {
                  title: 'message.router.AddPrompt',
                  isLink: '',
                  isHide: false,
                  isKeepAlive: true,
                  isAffix: true,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-plus',
                }
              },
              {
                path: '/random/character_panel',
                name: 'CharacterPanel',
                component: () => import('@renderer/views/random/CharacterPanel.vue'),
                meta: {
                  title: 'message.router.CharacterPanel',
                  isLink: '',
                  isHide: false,
                  isKeepAlive: true,
                  isAffix: true,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-bookmark-o',
                }
              },
              {
                path: '/random/tag_panel',
                name: 'TagPanel',
                component: () => import('@renderer/views/random/TagPanel.vue'),
                meta: {
                  title: 'message.router.TagPanel',
                  isLink: '',
                  isHide: false,
                  isKeepAlive: true,
                  isAffix: true,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-tags',
                }
              },
              {
                path: '/random/tag_count',
                name: 'TagCountPanel',
                component: () => import('@renderer/views/random/TagCountPanel.vue'),
                meta: {
                  title: 'message.router.TagCountPanel',
                  isLink: '',
                  isHide: true,
                  isKeepAlive: true,
                  isAffix: false,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-tags'
                }
              }
            ]
        },
        {
          path: '/socket',
            name: 'socket',
            component: () => import('@renderer/layout/routerView/parent.vue'),
            redirect: '/socket/socket_panel',
            meta: {
              title: 'message.router.Socket',
              isLink: '',
              isHide: false,
              isKeepAlive: true,
              isAffix: false,
              isIframe: false,
              roles: [],
              icon: 'fa fa-wifi',
            },
            children:[
              {
                path: '/socket/socket_panel',
                name: 'SocketPanel',
                component: () => import('@renderer/views/websocket/SocketPanel.vue'),
                meta: {
                  title: 'message.router.SocketPanel',
                  isLink: '',
                  isHide: false,
                  isKeepAlive: true,
                  isAffix: false,
                  isIframe: false,
                  roles: [],
                  icon: 'fa fa-wifi',
                },
              },

            ]
        },
        {
          path: '/ai',
          name: 'ai',
          component: () => import('@renderer/layout/routerView/parent.vue'),
          redirect: '/ai/ai_panel',
          meta: {
            title: 'message.router.AI',
            isLink: '',
            isHide: false,
            isKeepAlive: true,
            isAffix: false,
            isIframe: false,
            roles: [],
            icon: 'fa fa-random',
          },
          children:[
            {
              path: '/ai/ai_panel',
              name: 'AiPanel',
              component: () => import('@renderer/views/ai/AiPanel.vue'),
              meta:{
                title: 'message.router.AiPanel',
                isLink: '',
                isHide: true,
                isKeepAlive: true,
                isAffix: false,
                isIframe: false,
                roles: [],
                icon: 'fa fa-comment',
              }
            }
          ]
        },
        {
          path: '/comfyui',
          name: 'comfyui',
          component: () => import('@renderer/layout/routerView/parent.vue'),
          redirect: '/comfyui/comfyui_panel',
          meta: {
            title: 'message.router.Comfyui',
            isLink: '',
            isHide: false,
            isKeepAlive: true,
            isAffix: false,
            isIframe: false,
            roles: [],
            icon: 'fa fa-random',
          },
          children:[
            {
              path: '/comfyui/comfyui_panel',
              name: 'comfyuiPanel',
              component: () => import('@renderer/views/comfyui/comfyuiPanel.vue'),
              meta:{
                title: 'message.router.comfyuiPanel',
                isLink: '',
                isHide: true,
                isKeepAlive: true,
                isAffix: false,
                isIframe: false,
                roles: [],
                icon: 'fa fa-comment',
              }
            }
          ]
        },
        {
          path: '/lora',
          name: 'lora',
          component: () => import('@renderer/layout/routerView/parent.vue'),
          redirect: '/lora/lora_panel',
          meta: {
            title: 'message.router.Comfyui',
            isLink: '',
            isHide: false,
            isKeepAlive: true,
            isAffix: false,
            isIframe: false,
            roles: [],
            icon: 'fa fa-random',
          },
          children:[
            {
              path: '/lora/lora_panel',
              name: 'LoraPanel',
              component: () => import('@renderer/views/lora/LoraPanel.vue'),
              meta:{
                title: 'message.router.LoraPanel',
                isLink: '',
                isHide: false,
                isKeepAlive: true,
                isAffix: true,
                isIframe: false,
                roles: [],
                icon: 'fa fa-comment',
              }
            }
          ]
        },
        {
          path: '/translate',
          name: 'translate',
          component: () => import('@renderer/layout/routerView/parent.vue'),
          redirect: '/translate/manage_translate',
          meta: {
            title: 'message.router.TranslationManager',
            isLink: '',
            isHide: false,
            isKeepAlive: true,
            isAffix: false,
            isIframe: false,
            roles: [],
            icon: 'fa fa-random',
          },
          children:[
            {
              path: '/translate/manage_translate',
              name: 'TranslationManager',
              component: () => import('@renderer/views/translate/TranslationManager.vue'),
              meta:{
                title: 'message.router.TranslationManager',
                isLink: '',
                isHide: false,
                isKeepAlive: true,
                isAffix: true,
                isIframe: false,
                roles: [],
                icon: 'fa fa-comment',
              }
            }
          ]
        }
      ]
    }
]

export const notFoundAndNoPower = [
	{
		path: '/:path(.*)*',
		name: 'notFound',
		component: () => import('@renderer/views/error/404.vue'),
		meta: {
			title: 'message.staticRoutes.notFound',
			isHide: true,
		},
	},
	{
		path: '/401',
		name: 'noPower',
		component: () => import('@renderer/views/error/401.vue'),
		meta: {
			title: 'message.staticRoutes.noPower',
			isHide: true,
		},
	},
];

/**
 * 定义静态路由（默认路由）
 * 此路由不要动，前端添加路由的话，请在 `dynamicRoutes 数组` 中添加
 * @description 前端控制直接改 dynamicRoutes 中的路由，后端控制不需要修改，请求接口路由数据时，会覆盖 dynamicRoutes 第一个顶级 children 的内容（全屏，不包含 layout 中的路由出口）
 * @returns 返回路由菜单数据
 */
export const staticRoutes: Array<RouteRecordRaw> = [
	{
		path: '/static',
		name: 'static',
		component: () => import('@renderer/views/error/401.vue'),
		meta: {
			title: '静态',
		},
	},
];

